package com.yoomiito.app.widget.state;

import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.yoomiito.app.R;


/**
 */

public class EmptyType extends LayoutType {

    private TextView emptyTextView;
    private ImageView emptyImageView;
    private View emptyContentView;
    private TextView emptyPromptTextView;
    private int layoutId;
    private int imageResource = -1;
    private String emptyContent;
    private OnShowViewListener mShowViewListener;
    public EmptyType() {
        this.layoutId = R.layout.item_live_empty;
    }

    public EmptyType(int layoutId) {
        this.layoutId = layoutId;
    }


    @Override
    public int layoutId() {
        return layoutId;
    }

    @Override
    public void show(View emptyView) {
        TextView emptyTv = emptyView.findViewById(R.id.item_empty_tv);
        ImageView emptyIv = emptyView.findViewById(R.id.bg_empty);
        if (imageResource!=-1){
             emptyIv.setImageResource(imageResource);
        }
        if (!TextUtils.isEmpty(emptyContent)){
            emptyTv.setText(emptyContent);
        }
        if (mShowViewListener!=null){
            mShowViewListener.showView(emptyView);
        }
    }

    @Override
    public void hide() {

    }

    public EmptyType setImageResource(int imageResource) {
        this.imageResource = imageResource;
        return this;
    }

    public EmptyType setEmptyContent(String emptyContent) {
        this.emptyContent = emptyContent;
        return this;
    }

    public EmptyType setShowViewListener(OnShowViewListener showViewListener) {
        mShowViewListener = showViewListener;
        return this;
    }

    public interface OnShowViewListener{
        void showView(View view);
    }
}
